<template>
  <div>
    <div>
      <h2>编码名称：{{form.customerName}}</h2>
      <!--<el-form  label-width="120px">-->
        <!--<el-row>-->
          <!--<el-col :span="8">-->
            <!--<el-form-item label="客户创建时间">-->
              <!--<el-input v-model="form.customerCreateTime" :readonly="readOnly"/>-->
            <!--</el-form-item>-->
          <!--</el-col>-->
          <!--<el-col :span="8">-->
            <!--<el-form-item label="备注">-->
              <!--<el-input v-model="form.remarks"  :readonly="readOnly"/>-->
            <!--</el-form-item>-->
          <!--</el-col>-->
        <!--</el-row>-->
      <!--</el-form>-->
    </div>
    <font>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</font>
    <div  v-for="(historyData, index) in fromData"
          :key="index" >
      <el-col>
        <h2>{{historyData.taskNodeName}}</h2>
        <h3>审批人:{{historyData.createName}}</h3>
        <h3>审批时间:{{historyData.createdDate}}</h3>
        <el-form v-for="(fistoryFormData, indexH) in historyData.formHistoryDataDTO" :key="indexH" label-width="120px">
          <el-col :span="8">
            <el-form-item :label=fistoryFormData.title >
              <el-input v-model="fistoryFormData.value" :readonly="readOnly"/>
            </el-form-item>
          </el-col>
        </el-form>
      </el-col>
      <font>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</font>
    </div>
  </div>
</template>

<script>
  import { getBigcustomer } from '@/api/flow/bigcustomer'
  import { historyFromData } from '@/api/activiti/historyFormdata'
  export default {
    name: "handleHistoryForm",
    props: {
      businessKey: {
        type: String
      }
    },
    data(){
      return{
        // 表单参数
        readOnly:true,
        form: {},
        fromData:[],
        handledformHistoryData:[]
      }
    },
    created() {
      this.getBigcustomer()
      this.historyFromData()
    },
    methods:{
      getBigcustomer() {
        getBigcustomer(this.businessKey).then(response => {
          this.form = response.data
        })
      },
      historyFromData() {
        historyFromData(this.businessKey).then(response => {
          this.fromData = response.data
          // console.log(this.fromData)
          // this.handleFormData(this.fromData)
        })
      },
      handleFormData(formData){
        this.handledformHistoryData.push(this.fromData[0])
        let temp_index = 0
        const len = formData[1].formHistoryDataDTO.length
        while (temp_index < len){
          for (let i = 1; i < formData.length; i++){
            let temp_dto = {}
            let temp_array = []
            temp_dto.createName = formData[i].createName
            temp_dto.createdDate = formData[i].createdDate
            temp_dto.taskNodeName = formData[i].taskNodeName
            for (let j = temp_index+0; j < temp_index+2;j++){
              temp_array[j-temp_index] = formData[i].formHistoryDataDTO[j]
            }
            temp_dto.formHistoryDataDTO = temp_array
            this.handledformHistoryData.push(temp_dto)
          }
          temp_index+=2
        }
      }
    }
  }
</script>

<style scoped>

</style>
